#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
#define endl "\n"
using namespace std;
int main()
{
	const int mod = 1e9 + 7;
	int n, a[4] = { 0,1,2,5 };
	cin >> n;
	for (int i = 4; i <= n; i++)
	{
		a[0] = (2 * a[3] % mod + a[1] % mod) % mod;
		for (int i = 1; i <=2; i++)
		{
			a[i] = a[i + 1];
		}
		a[3] = a[0];
	}
	if (n <= 3)
		cout << a[n];
	else
		cout << a[3];
	return 0;
}